package com.JobFind.util;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;

public class SpringBeanFactory implements BeanFactoryAware {

	private static BeanFactory springBeanFactory;
	
	public static Object getBean(String beanName) {
		System.out.println("beanFactory--->"+springBeanFactory );
		 return springBeanFactory.getBean(beanName);
	}
	
	public static <T> T getBean(String beanName, Class<T> clazs) {
		 return clazs.cast(getBean(beanName));
	}
	
	public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
		SpringBeanFactory.springBeanFactory = beanFactory;
	}
}